﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>职员表单</title>
    <link href="/Themes/Styles/style.css" rel="stylesheet" />
    <script src="../../Themes/Scripts/jquery-1.8.2.min.js"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/artDialog.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script>
        $(function () {
            divresize('.ScrollBar', 90);
            InitBindDrop();
            if (IsNullOrEmpty(GetQuery('key'))) {
                InitControl();
                CompanyClick("CompanyId");
                InitControl();
                DepartmentClick("DepartmentId");
                InitControl();
            }
        })

        //初始化绑定下拉框，公司，部门，工作组,数据字典
        var datajson = "";
        function InitBindDrop() {
            //最高学历
            $("#Education").append("<option value=''>" + "==请选择==" + "</option>");
            //最高学位
            $("#Degree").append("<option value=''>" + "==请选择==" + "</option>");
            //职称
            $("#TitleId").append("<option value=''>" + "==请选择==" + "</option>");
            //职称等级
            $("#TitleLevel").append("<option value=''>" + "==请选择==" + "</option>");
            //职位
            $("#DutyId").append("<option value=''>" + "==请选择==" + "</option>");
            //用工性质
            $("#WorkingProperty").append("<option value=''>" + "==请选择==" + "</option>");
            //政治面貌
            $("#Party").append("<option value=''>" + "==请选择==" + "</option>");
            //国籍
            $("#Nation").append("<option value=''>" + "==请选择==" + "</option>");
            //民族
            $("#Nationality").append("<option value=''>" + "==请选择==" + "</option>");
            var itemjson = "";
            getAjax("/Employee/InitBindDrop", "", function (data) {
                itemjson = eval("(" + data + ")");
                $.each(itemjson, function (i) {
                    if (itemjson[i].ItemsId == '1559ff6d-8b04-48f7-952c-333305bc526d') {
                        $("#Education").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == '964d6a06-5282-4fcb-b805-f192ae0de922') {
                        $("#Degree").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == '2acba9e8-5fa7-4b6f-8ebd-56e753dd059a') {
                        $("#TitleId").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == 'b65809f0-3b7b-44d1-b2f5-c93ef9afa12d') {
                        $("#TitleLevel").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == '137a2d97-d1d9-4752-9c5e-239097e2ed68') {
                        $("#DutyId").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == '0e08fdaa-8e7a-4890-98d5-e2f36f55c512') {
                        $("#WorkingProperty").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == '44e210fb-5afd-4511-a56c-a438d947d5bc') {
                        $("#Party").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == 'e2e78aec-31f7-4de5-af7b-bb5bc7c09a61') {
                        $("#Nation").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                    if (itemjson[i].ItemsId == '104bfd21-5bbe-4b96-b5c2-448b84dbe0d8') {
                        $("#Nationality").append($("<option></option>").val(itemjson[i].ItemCode).html(itemjson[i].ItemName));
                    }
                });
            })


            //公司，部门，工作组
            $("#CompanyId").append("<option value=''>" + "==请选择==" + "</option>");
            $("#DepartmentId").append("<option value=''>" + "==请选择==" + "</option>");
            $("#WorkgroupId").append("<option value=''>" + "==请选择==" + "</option>");
            getAjax("/Organize/LoadAction", "action=LoadBindDrop", function (data) {
                datajson = eval("(" + data + ")");
                $.each(datajson, function (i) {
                    if (datajson[i].Category == '公司') {
                        $("#CompanyId").append($("<option></option>").val(datajson[i].OrganizationId).html(datajson[i].FullName));
                    }
                });
            })
        }
        function CompanyClick(id) {
            $("#DepartmentId").empty();
            $("#DepartmentId").append("<option value=''>" + "==请选择==" + "</option>");
            $.each(datajson, function (i) {
                if (datajson[i].ParentId == $('#' + id).val()) {
                    $("#DepartmentId").append("<option value='" + datajson[i].OrganizationId + "'>" + datajson[i].FullName + "</option>");
                }
            });
        }
        function DepartmentClick(id) {
            $("#WorkgroupId").empty();
            $("#WorkgroupId").append("<option value=''>" + "==请选择==" + "</option>");
            $.each(datajson, function (i) {
                if (datajson[i].ParentId == $('#' + id).val()) {
                    $("#WorkgroupId").append("<option value='" + datajson[i].OrganizationId + "'>" + datajson[i].FullName + "</option>");
                }
            });
        }
        //保存事件
        function AcceptClick() {
            if (!CheckDataValid('#form1')) {
                return false;
            }
            var postData = GetWebControls("#form1");
            getAjax("/Employee/AcceptClick?key=" + GetQuery('key'), postData, function (data) {
                if (IsNullOrEmpty(GetQuery('key'))) {
                    if (data) { AlertParmCallback("恭喜您，更新成功。"); return false; }
                } else {
                    if (data) { AlertParmCallback("恭喜您，新增成功。"); return false; }
                }
                if (!data) {
                    Alert_Error("很抱歉，操作失败。"); return false;
                } else {
                    Alert_Wern(data); return false;
                }
            });
        }
        //得到一个对象实体
        function InitControl() {
            getAjax("/Employee/InitControl", { key: GetQuery('key') }, function (data) {
                var data = eval("(" + data + ")");
                SetWebControls(data);
                if (data.Birthday.length > 0) {
                    $("#Birthday").val(new Date(data.Birthday).pattern("yyyy-MM-dd"));
                }
            });
        }
    </script>
</head>
<body>
    <form id="form1">
        <input id="hiddenCompanyId" type="hidden" />
        <input id="hiddenDepartmentId" type="hidden" />
        <input id="hiddenWorkgroupId" type="hidden" />
        <div class="bd">
            <div class="tipstitle_title settingtable bold bd todayInfoPanelTab rightPanelTitle_normal">
                <div class="tab_list_top" style="position: absolute">
                    <div id="basicTab" class="tab_list bd actived" onclick="Tabchange('tb_basic')">基本信息</div>
                    <div id="workTab" class="tab_list bd " onclick="Tabchange('tb_work')">工作相关</div>
                    <div id="homeTab" class="tab_list bd " onclick="Tabchange('tb_home')">家庭相关</div>
                    <div id="formTab" class="tab_list bd " onclick="Tabchange('tb_custom')">自定义相关</div>
                </div>
            </div>
            <div class="ScrollBar">
                <br />
                <div id="tb_basic" class="tabPanel">
                    <table border="0" cellpadding="0" cellspacing="0" class="frm">
                        <tr>
                            <th>姓名[<font face="宋体">*</font>]：</th>
                            <td>
                                <input id="RealName" maxlength="50" type="text" datacol="yes" err="姓名" checkexpession="NotNull" class="txt" style="width: 220px" />
                            </td>
                            <th>工号[<font face="宋体">*</font>]：</th>
                            <td>
                                <input id="Code" maxlength="50" type="text" datacol="yes" err="编号,工号" checkexpession="NotNull" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>性别：</th>
                            <td>
                                <select id="Gender" class="select" style="width: 226px">
                                    <option value="男">男</option>
                                    <option value="女">女</option>
                                </select>
                            </td>
                            <th>公司[<font face="宋体">*</font>]：
                            </th>
                            <td>
                                <select id="CompanyId" onchange="CompanyClick(this.id)" class="select" datacol="yes" err="公司" checkexpession="NotNull" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>部门名称<font face="宋体"></font>：
                            </th>
                            <td>
                                <select id="DepartmentId" onchange="DepartmentClick(this.id)" class="select" datacol="yes"  checkexpession="NotNull"  err="部门名称"  style="width: 227px">
                                </select>
                            </td>
                            <th>工作组名称：
                            </th>
                            <td>
                                <select id="WorkgroupId" class="select" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>出生日期：</th>
                            <td>
                                <input id="Birthday" maxlength="23" onfocus="WdatePicker()" class="txt Wdate" type="text" style="width: 220px" />
                            </td>
                            <th>年龄[<font face="宋体">*</font>]：</th>
                            <td>
                                <input id="Age" maxlength="3" type="text" class="txt" datacol="yes" err="年龄"
                                    checkexpession="Num" onfocus="Keypress(this.id)" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>所学专业：</th>
                            <td>
                                <input id="Major" maxlength="50" type="text" class="txt" style="width: 220px" />
                            </td>
                            <th>毕业院校： </th>
                            <td>
                                <input id="School" maxlength="200" type="text" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>

                            <th>最高学历：</th>
                            <td>
                                <select id="Education" class="select" style="width: 227px">
                                </select>
                            </td>
                            <th>最高学位：</th>
                            <td>
                                <select id="Degree" class="select" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>职称：</th>
                            <td>
                                <select id="TitleId" class="select" style="width: 227px">
                                </select>
                            </td>
                            <th>职称等级： </th>
                            <td>
                                <select id="TitleLevel" class="select" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>职称评期：</th>
                            <td>
                                <input id="Text1" maxlength="50" type="text" class="txt" style="width: 220px" />
                            </td>
                            <th>有效：</th>
                            <td>
                                <span class="item">
                                    <input id="Enabled" type="checkbox" checked="checked" style="vertical-align: middle;" />
                                    <label for="Enabled" style="vertical-align: middle;">有效</label>
                                    &nbsp;&nbsp;
                                </span>
                            </td>
                        </tr>
                        <tr>
                            <th>描述：</th>
                            <td colspan="3">
                                <textarea id="Description" maxlength="200" type="text" class="txtArea" rows="5" style="width: 594px"></textarea>
                            </td>
                        </tr>
                    </table>
                </div>

                <div id="tb_work" class="tabPanel" style="display: none;">
                    <table border="0" cellpadding="0" cellspacing="0" class="frm">
                        <tr>
                            <th>职位：</th>
                            <td>
                                <select id="DutyId" class="select" style="width: 227px">
                                </select>
                            </td>
                            <th>用工性质：</th>
                            <td>
                                <select id="WorkingProperty" class="select" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>身份证号码：</th>
                            <td>
                                <input id="IDCard" maxlength="18" type="text" class="txt" datacol="yes" err="身份证号码" checkexpession="IDCardOrNull" style="width: 220px" />
                            </td>
                            <th>工资卡：</th>
                            <td>
                                <input id="BankCode" maxlength="50" type="text" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>加入单位：</th>
                            <td>
                                <input id="JoinInDate" onfocus="WdatePicker()" class="txt Wdate" type="text" style="width: 220px" />
                            </td>
                            <th>电子邮件：</th>
                            <td>
                                <input id="Email" maxlength="50" type="text" datacol="yes" err="电子邮件" checkexpession="isEmailOrNull" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>QQ号码：</th>
                            <td>
                                <input id="OICQ" maxlength="15" type="text" class="txt" style="width: 220px" />
                            </td>
                            <th>手机：</th>
                            <td>
                                <input id="Mobile" maxlength="11" type="text" class="txt" datacol="yes" err="手机" checkexpession="MobileOrNull" style="width: 220px" />
                            </td>

                        </tr>
                        <tr>
                            <th>短号：</th>
                            <td>
                                <input id="ShortNumber" maxlength="10" type="text" class="txt" style="width: 220px" />
                            </td>
                            <th>办公邮编：</th>
                            <td>
                                <input id="OfficeZipCode" maxlength="6" type="text" class="txt" style="width: 220px" />
                            </td>

                        </tr>
                        <tr>
                            <th>办公电话：</th>
                            <td>
                                <input id="OfficePhone" maxlength="15" type="text" class="txt" datacol="yes" err="办公电话" checkexpession="PhoneOrNull" style="width: 220px" />
                            </td>
                            <th>办公传真：</th>
                            <td>
                                <input id="OfficeFax" maxlength="15" type="text" class="txt" datacol="yes" err="办公传真" checkexpession="PhoneOrNull" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>办公地址：</th>
                            <td colspan="3">
                                <input id="OfficeAddress" maxlength="200" type="text" class="txt" style="width: 594px" />
                            </td>
                        </tr>
                        <tr>
                            <th>是否离职：</th>
                            <td colspan="3">
                                <span class="item">
                                    <input id="IsDimission" type="checkbox" checked="checked" style="vertical-align: middle;" />
                                    <label for="IsDimission" style="vertical-align: middle;">离职</label>
                                    &nbsp;&nbsp; 
                                </span>
                            </td>
                        </tr>
                        <tr>
                            <th>离职日期：</th>
                            <td>
                                <input id="DimissionDate" onfocus="WdatePicker()" class="txt Wdate" type="text" style="width: 220px" />
                            </td>
                            <th>离职去向：</th>
                            <td>
                                <input id="DimissionWhither" maxlength="200" type="text" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>离职原因：</th>
                            <td colspan="3">
                                <input id="DimissionCause" maxlength="200" type="text" class="txt" style="width: 594px" />
                            </td>
                        </tr>
                    </table>
                </div>

                <div id="tb_home" class="tabPanel" style="display: none;">
                    <table border="0" cellpadding="0" cellspacing="0" class="frm">
                        <tr>
                            <th>籍贯：</th>
                            <td>
                                <input id="NativePlace" maxlength="50" type="text" class="txt" style="width: 220px" />
                            </td>
                            <th>家庭邮编：</th>
                            <td>
                                <input id="HomeZipCode" maxlength="6" type="text" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>家庭传真：</th>
                            <td>
                                <input id="HomeFax" maxlength="15" type="text" class="txt" style="width: 220px" />
                            </td>
                            <th>政治面貌：</th>
                            <td>
                                <select id="Party" class="select" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>国籍：</th>
                            <td>
                                <select id="Nation" class="select" style="width: 227px">
                                </select>
                            </td>
                            <th>民族：</th>
                            <td>
                                <select id="Nationality" class="select" style="width: 227px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>住宅电话：</th>
                            <td>
                                <input id="HomePhone" maxlength="15" type="text" class="txt" datacol="yes" err="住宅电话" checkexpession="PhoneOrNull" style="width: 220px" />
                            </td>
                            <th>紧急联系：</th>
                            <td>
                                <input id="EmergencyContact" maxlength="50" type="text" class="txt" style="width: 220px" />
                            </td>
                        </tr>
                        <tr>
                            <th>家庭住址：</th>
                            <td colspan="3">
                                <input id="HomeAddress" maxlength="200" type="text" class="txt" style="width: 594px" />
                            </td>
                        </tr>
                        <tr>
                        </tr>
                    </table>
                </div>

                <div id="tb_custom" class="tabPanel" style="display: none;">
                    自定义相关
                </div>
            </div>
        </div>

        <div class="frmbottom">
            <a id="Accept" class="l-btn" href="javascript:void(0)" onclick="AcceptClick();"><span class="l-btn-left">
                <img src="/Themes/Images/16/accept.png" alt="" />确 认</span></a>

            <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
                <img src="/Themes/Images/16/cancel.png" alt="" />关 闭</span></a>
        </div>
    </form>
</body>
</html>
